#!/bin/bash

NCL_SCRIPT_PATH="$HOME/Codes/WRF_scripts/WRF_Post/"
wrfpost_dir="$HOME/wrfpost"
domain="d02"
d02_list=`find ~/wrfout/*/ -name "*wrfout_d02*" -ctime -40`
cd $NCL_SCRIPT_PATH
mask_file="/public/users/wrf/Data/WuJiang_Map/wujiang_domaian_mask_d02.csv"
area_precip_dir="$wrfpost_dir/txt/areal_precip/WuJiang"
mkdir -p $area_precip_dir
for ifile in $d02_list
do
    echo $ifile
    start_date=${ifile:25:10}
    echo $start_date
    ncl areaMaskFile='"'$mask_file'"' input_file='"'$ifile'"' output_prefix='"'$area_precip_dir'"' wrfout_to_areal_precip.ncl
done

